import { Table } from 'antd';

const List = ({ dataList, selectKeys, dispatch }) => {
  const columns = [
    {
      title: 'Id',
      key: 'Id',
      dataIndex: 'Id',
    },
    {
      title: 'Name',
      key: 'Name',
      dataIndex: 'Name',
    }, {
      title: 'Driver',
      key: 'Driver',
      dataIndex: 'Driver',
    }, {
      title: 'Gateway',
      key: 'Gateway',
      dataIndex: 'IPAM.Config.0.Gateway',
      render: (text, record) => (
        <span>
          {text}
        </span>
      ),
    },
    {
      title: 'Created',
      key: 'Created',
      dataIndex: 'Created',
    }, {
      title: 'Scope',
      key: 'Scope',
      dataIndex: 'Scope',
    },
  ];
  const dataSource = dataList.map(item => {
    return { ...item, key: item.Id };
  });
  const rowSelectKey = {
    onChange: (select) => {
      dispatch({type:'docker/network/updateSelect',payload:{select}});
    },
    selectedRowKeys:selectKeys
  };
  return (
    <div>
      <Table columns={columns} rowSelection={rowSelectKey} dataSource={dataSource}/>
    </div>
  );
};
export default List;
